package com.zsk.shop;

import com.zsk.shop.common.constant.Constant;
import com.zsk.shop.common.constant.StaticConfigUtil;
import com.zsk.shop.common.utils.DingTalkRootUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author lv
 */
@Component
public class InitProject implements ApplicationRunner {
    private static final Logger logger = LoggerFactory.getLogger(InitProject.class);

    @Autowired
    private DingTalkRootUtil dingTalkRootUtil;

    @Override
    public void run(ApplicationArguments args) {
        logger.info("shop项目启动后运行内容");
        //后期接入钉钉通知
        if (!Constant.isLocal()) {
            dingTalkRootUtil.sendOtherInfo("zsk_shop_" + StaticConfigUtil.getEnv() + "，重启成功！", "", false, true);
        }
    }
}
